﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	调节水池
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div id="dolphincontainer">
	    <div id="dolphinnav">
	        <ul class="top_tab">
	            <li><a href="/Stack/Index"><span>堆场管理</span></a></li>
                <li><a href="/Stack/Edit/<%=ViewData["id"] %>"><span>基本信息</span></a></li>
                <li><a href="/Stack/Weather/<%=ViewData["id"] %>"><span>气象信息</span></a></li>
                <li><a href="/Stack/Stack/<%=ViewData["id"] %>"><span>堆场信息</span></a></li>
                <li><a href="javascript:return(false);" class="current"><span>调节水池</span></a></li>
                <li><a href="/Stack/Material/<%=ViewData["id"] %>"><span>材料信息</span></a></li>
                <li><a href="/Stack/Settle/<%=ViewData["id"] %>"><span>沉降模型</span></a></li>
                <li><a href="/Stack/Piezometer/<%=ViewData["id"] %>"><span>测压井测压仪</span></a></li>
                <li><a href="/Stack/Drain/<%=ViewData["id"] %>"><span>导渗系统</span></a></li>
                <li><a href="/Position/List?type=1&stackId=<%=ViewData["id"] %>"><span>上传图片</span></a></li>
	        </ul>
	    </div>
	</div>

    
    <% 
    Return_Water_Pond_Base_Info[] pools = (Return_Water_Pond_Base_Info[])ViewData["pools"];
    int poolNum = pools.Length;

    Runoff_Interception_Ditch_Base_Info[] ditches = (Runoff_Interception_Ditch_Base_Info[])ViewData["ditches"];
    int ditchNum = ditches.Length;
    using (Html.BeginForm("Pool", "Stack", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
    %>
        <%= Html.ValidationSummary(true) %>
        <%= Html.Hidden("id", (int)ViewData["id"])%>
        <%
           bool result = (bool)ViewData["success"];
           if(result){ 
        %>
           <div class="tips_area">调节水池、截洪沟更新成功</div>
        <%
        }
        %>
    
    
    <div style="margin-left:10px;margin-top:5px;font-size:14px;font-weight:bold">调节水池</div>      
    
    <fieldset class="tf_style" style="width:96%;">
        <legend>调节水池</legend>
        
        <div style="margin-left:18px;margin-top:10px;">调节水池设计图：<input type="file" size="50" name="poolDesignPic" /><%if(!string.IsNullOrEmpty((string)ViewData["poolDesignPic"])) {%><a href="<%=Url.Content((string)ViewData["poolDesignPic"]) %>" target="_blank">查看原图</a><%} %></div>

        <div id="pools">
            <%
            int i = 0;
            string[] poolElArray = (string[])ViewData["poolElArray"];           
            foreach (Return_Water_Pond_Base_Info pool in pools)
            {
            %>
            <table id="pool<%=i + 1 %>" cellpadding="4" cellspacing="0" class="com_detail_table2" style="margin-top:8px;">
                <tr>
                    <th colspan="4"><%= i + 1 %>号调节水池<%if (i > 0) { %> <a style='margin-right:5px' href="javascript:void(0);" onclick="removePool(<%=i + 1 %>);">X</a><%} %></th>
                </tr>

                <tr>
                    <td class="lab" style="width:100px;">底部高程：</td>
                    <td style="width:130px;">
                        <%= Html.TextBox("base_El" + (i + 1), pool.base_El, new { size = "8" })%>
                    </td>
                    <td class="lab" style="width:100px;">底部面积：</td>
                    <td>
                        <%= Html.TextBox("base_area" + (i + 1), pool.base_area, new { size = "8" })%>
                    </td>
                </tr>
                <tr>
                    <td class="lab">顶部高程：</td>
                    <td>
                        <%= Html.TextBox("top_EL" + (i + 1), pool.top_EL, new { size = "8" })%>
                    </td>
                    <td class="lab">顶部面积：</td>
                    <td>
                        <%= Html.TextBox("top_area" + (i + 1), pool.top_area, new { size = "8" })%>
                    </td>
                </tr>
                <tr>
                    <td class="lab">平均面积：</td>
                    <td>
                        <%= Html.TextBox("middle_avg_water_area" + (i + 1), pool.middle_avg_water_area, new { size = "8" })%>
                    </td>
                    <td class="lab">平均边坡面积：</td>
                    <td>
                        <%= Html.TextBox("avg_slope_HDPE_area" + (i + 1), pool.avg_slope_HDPE_area, new { size = "8" })%>
                    </td>
                </tr>
                <tr>
                    <td class="lab">最小深度：</td>
                    <td>
                        <%= Html.TextBox("Min_Depth" + (i + 1), pool.Min_Depth, new { size = "8" })%>
                    </td>
                    <td class="lab">平均深度：</td>
                    <td>
                        <%= Html.TextBox("Avg_Depth" + (i + 1), pool.Avg_Depth, new { size = "8" })%>
                    </td>
                </tr>
                <tr>
                    <td class="lab">平均最大深度：</td>
                    <td colspan="3">
                        <%= Html.TextBox("Avg_Depth_max" + (i + 1), pool.Avg_Depth_max, new { size = "8" })%>
                    </td>
                </tr>
                <tr>
                    <td class="lab">高程-面积数据<br />(高程-面积)：</td>
                    <td colspan="3">
                        <%= Html.TextArea("El_areas" + (i + 1), poolElArray[i], new { cols = "40", rows = "8" })%>
                    </td>
                </tr>


            </table>
            <%
                i++;
            }
            %>
        </div>

        <p><input type="button" value="增加调节水池" onclick="addPool();" /></p>

    </fieldset>


    <fieldset class="tf_style" style="width:96%;">
        <legend>截洪沟</legend>
        <div style="margin-left:18px;margin-top:10px;">截洪沟设计图：<input type="file" name="ditchDesignPic" size="50" /><%if(!string.IsNullOrEmpty((string)ViewData["ditchDesignPic"])){ %> <label class="icon_12"><a href="<%=Url.Content((string)ViewData["ditchDesignPic"]) %>" target="_blank">查看原图</a></label><%} %></div>

        <table id="ditches" cellpadding="4" cellspacing="0" class="com_detail_table2" style="margin-top:8px; text-align:center;">
            <%
            i = 0;
            foreach (Runoff_Interception_Ditch_Base_Info ditch in ditches)
            {
                 i++;
             %>
            <tr id="ditch<%=i %>">
                <td><strong>第<%= i %>号截洪沟</strong></td>
                <td class="lab" style="width:60px;">高程：</td>
                <td style="text-align:left;"><%= Html.TextBox("ditch_El" + i, ditch.El, new { size = "5" })%></td>
                <td class="lab" style="width:60px;">面积：</td>
                <td style="text-align:left;"><%= Html.TextBox("ditch_Area" + i, ditch.Area, new { size = "6" })%></td>
                <td class="lab" style="width:60px;">长度：</td>
                <td style="text-align:left;"><%= Html.TextBox("ditch_length" + i, ditch.length, new { size = "6" })%></td>
                <td class="lab" style="width:60px;">方位：</td>
                <td style="text-align:left;">
                    <select name="ditch_position<%=i %>">
                        <option value="0">请选择</option>
                        <option value="1" <%if (ditch.position == 1) {%>selected="selected"<%} %>>东</option>
                        <option value="2" <%if (ditch.position == 2) {%>selected="selected"<%} %>>东南</option>
                        <option value="3" <%if (ditch.position == 3) {%>selected="selected"<%} %>>南</option>
                        <option value="4" <%if (ditch.position == 4) {%>selected="selected"<%} %>>西南</option>
                        <option value="5" <%if (ditch.position == 5) {%>selected="selected"<%} %>>西</option>
                        <option value="6" <%if (ditch.position == 6) {%>selected="selected"<%} %>>西北</option>
                        <option value="7" <%if (ditch.position == 7) {%>selected="selected"<%} %>>北</option>
                        <option value="8" <%if (ditch.position == 8) {%>selected="selected"<%} %>>东北</option>
                    </select>
                </td>
                <td><input type="checkbox" name="ditch_unused<%=i %>" <%if(ditch.unused==1){%>checked="checked"<%} %> value="1" />未使用</td>
                <td><%if (i > 2) { %><a style='float:right; margin-right:5px' href="javascript:void(0);" onclick="removePool(<%=i %>);">X</a><%} %></td>
            </tr>
            <%} %>
        </table>

        <p><input type="button" value="增加截洪沟" onclick="addDitch();" /></p>

    </fieldset>



    
                
       
    <div class="submit_btn_area" style="margin-left:138px;">
        <%= Html.Hidden("totalPoolNum", poolNum)%>
        <%= Html.Hidden("totalDitchNum", ditchNum)%>
        <input type="submit" value="提 交" />
    </div>
    <% } %>

    <script type="text/javascript"" language="javascript">
        var poolNum = <%= poolNum%>;
        function getInnerHtml(poolNo)
        {
            var htmlStr = "<table id='pool" + poolNo + "' cellpadding='4' cellspacing='0' class='com_detail_table2' style='margin-top:8px;'><tr><th colspan='4'>" + poolNo + "号调节水池<a style='float:right; margin-right:5px' href='javascript:void(0);' onclick='removePool(" + poolNo + ");'>X</a></th></tr><tr><td class='lab' style='width:100px;'>底部高程：</td><td style='width:130px;'><input size='8' type='text' name='base_El" + poolNo + "' value='' /></td><td class='lab' style='width:100px;'>底部面积：</td><td><input size='8' type='text' name='base_area" + poolNo + "' value='' /></td></tr><tr><td class='lab'>顶部高程：</td><td><input size='8' type='text' name='top_EL" + poolNo + "' value='' /></td><td class='lab'>顶部面积：</td><td><input size='8' type='text' name='top_area" + poolNo + "' value='' /></td></tr><tr><td class='lab'>平均面积：</td><td><input size='8' type='text' name='middle_avg_water_area" + poolNo + "' value='' /></td><td class='lab'>平均边坡面积：</td><td><input size='8' type='text' name='avg_slope_HDPE_area" + poolNo + "' value='' /></td></tr><tr><td class='lab'>最小深度：</td><td><input size='8' type='text' name='Min_Depth" + poolNo + "' value='' /></td><td class='lab'>平均深度：</td><td><input size='8' type='text' name='Avg_Depth" + poolNo + "' value='' /></td></tr><tr><td class='lab'>平均最大深度：</td><td colspan='3'><input size='8' type='text' name='Avg_Depth_max" + poolNo + "' value='' /></td></tr><tr><td class='lab'>高程-面积数据<br />(高程-面积)：</td><td colspan='3'><textarea name='El_areas" + poolNo + "' value='' cols='40' rows='8'></textarea></td></tr></table>";

	        return htmlStr;
        }        
        
        function addPool() {
            poolNum++;
            $("#pools").append(getInnerHtml(poolNum));
            document.getElementById("totalPoolNum").value = poolNum;
        }

        function removePool(poolNo) {
            poolNum--;
            $("#pool" + poolNo).remove();
            document.getElementById("totalPoolNum").value = poolNum;
        }

        var ditchNum = <%= ditchNum%>;
        function getDitchInnerHtml(ditchNo)
        {
            var htmlStr = "<tr id='ditch" + ditchNo + "'><td><strong>第" + ditchNo + "号截洪沟</strong></td><td class='lab' style='width:60px;'>高程：</td><td style='text-align:left;'><input size='5' type='text' value='' name='ditch_El" + ditchNo + "' /></td><td class='lab' style='width:60px;'>面积：</td><td style='text-align:left;'><input size='6' type='text' value='' name='ditch_Area" + ditchNo + "' /></td><td class='lab' style='width:60px;'>长度：</td><td style='text-align:left;'><input size='6' type='text' name='ditch_length" + ditchNo +"' value='' /></td><td class='lab' style='width:60px;'>方位：</td><td style='text-align:left;'><select name='ditch_position" + ditchNo + "'><option value='0'>请选择</option><option value='1'>东</option><option value='2'>东南</option><option value='3'>南</option><option value='4'>西南</option><option value='5'>西</option><option value='6'>西北</option><option value='7'>北</option><option value='8'>东北</option></select></td><td><input name='ditch_unused" + ditchNo + "' type='checkbox' value='1' />未使用</td><td><a class='a_color39f' style='float:right; margin-right:5px' href='javascript:void(0);' onclick='removeDitch(" + ditchNo + ");'>X</a></td></tr>";

	        return htmlStr;
        }        
        
        function addDitch() {
            ditchNum++;
            $("#ditches").append(getDitchInnerHtml(ditchNum));
            document.getElementById("totalDitchNum").value = ditchNum;
        }

        function removeDitch(ditchNo) {
            ditchNum--;
            $("#ditch" + ditchNo).remove();
            document.getElementById("totalDitchNum").value = ditchNum;
        }



    </script>
</asp:Content>
